

<title>后台管理员</title>
  
<div class="layui-card layadmin-header">
  <div class="layui-breadcrumb" lay-filter="breadcrumb">
    <a lay-href="">主页</a>
    <a><cite>用户管理</cite></a>
    <a><cite>用户列表</cite></a>
  </div>
</div>

<div class="layui-fluid">   
  <div class="layui-card">
    <div class="layui-form layui-card-header layuiadmin-card-header-auto" lay-filter="formlist">
      <div class="layui-form-item">
        <div class="layui-inline">
          <!-- <label class="layui-form-label">手机</label> -->
          <!-- <div class="layui-input-block"> -->
            <input type="text" name="telphone" placeholder="搜索手机" autocomplete="off" class="layui-input" lay-verify="loginname">
          <!-- </div> -->
        </div>
        <div class="layui-inline">
          <input type="text" name="email" placeholder="搜索邮箱" autocomplete="off" class="layui-input">
        </div>
        <!-- <div class="layui-inline">
          <label class="layui-form-label">角色</label>
          <div class="layui-input-inline">
            <select name="role">
              <option value="0">管理员</option>
              <option value="1">超级管理员</option>
              <option value="2">纠错员</option>
              <option value="3">采购员</option>
              <option value="4">推销员</option>
              <option value="5">运营人员</option>
              <option value="6">编辑</option>
            </select>
          </div>
        </div> -->

        <div class="layui-inline">
          <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="searchData">
            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
          </button>
        </div>
      </div>
    </div>
    
    <div class="layui-card-body">
      <div style="padding-bottom: 10px;">
        <button class="layui-btn layuiadmin-btn-admin" data-type="batchdel">删除</button>
        <button class="layui-btn layuiadmin-btn-admin" data-type="add">添加</button>
      </div>
      
      <table id="listData" lay-filter="listData"></table>  
      <script type="text/html" id="buttonTpl">
        {{#  if(d.is_check == 1){ }}
          <button class="layui-btn layui-btn-xs">已审核</button>
        {{#  } else { }}
          <button class="layui-btn layui-btn-primary layui-btn-xs">未审核</button>
        {{#  } }}
      </script>
      <script type="text/html" id="table-useradmin-admin">
        <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
        {{#  if(d.id == 1){ }}
          <a class="layui-btn layui-btn-disabled layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>删除</a>
        {{#  } else { }}
          <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
        {{#  } }}
      </script>
    </div>
  </div>
</div>

<script>
	// 定义数据
	var setData = {
	    list_url:{href:"user/list", title:'数据列表'}
	    ,add_page:{href:"user/add", title:'新增数据'}
      ,add_url:{href:"admin/add", title:'新增数据'}
	    ,status:{href:"user/status", title:'修改状态'}
	    ,edit_page:{href:"user/add", title:'修改数据'}
      ,edit_url:{href:"admin/add", title:'修改数据'}
	    ,del_url:{href:"admin/del", title:'删除数据'}
	};

	layui.use('public', layui.factory('public')).use(['admin','table'], function(){
	  var $ = layui.$
	  ,admin = layui.admin
	  ,table = layui.table;
	  
    //用户管理
		table.render({
			elem: '#listData'
			,url: setData.list_url.href //模拟接口
			,response: {
				statusCode: 1 //规定成功的状态码，默认：0
			}
			// ,parseData: function(res){ //res 即为原始返回的数据
			// 	// return {
			// 	// 	"code": res.code, //解析接口状态
			// 	// 	"msg": res.message, //解析提示文本
			// 	// 	"count": res.count, //解析数据长度
			// 	// 	"data": res.data //解析数据列表
			// 	// };
			// }
			,cols: [[
				{type: 'checkbox', fixed: 'left'}
				,{field: 'id', width: 60, title: 'ID', sort: true}
				,{field: 'loginname', title: '登录名'}
				,{field: 'telphone', title: '手机'}
				,{field: 'email', title: '邮箱'}
				,{field: 'role', title: '角色'}
				,{field: 'jointime', title: '加入时间', sort: true}
				,{field: 'is_check', title:'审核状态', templet: '#buttonTpl', minWidth: 80, align: 'center'}
				,{title: '操作', width: 150, align: 'center', fixed: 'right', toolbar: '#table-useradmin-admin'}
			]]
			,page: true
			,limit: 30
			,height: 'full-320'
			,text: '对不起，加载出现异常！'
		})
	});

</script>